/*
 * Shanghai Buyan Technology Development Co., Ltd
 * Web Site: http://www.buyantech.com
 * Since 2011 - 2012
 */package com.buyantech.smweb.dao;

import javacommon.base.*;
import cn.org.rapid_framework.page.*;
import com.buyantech.smweb.model.*;
import com.buyantech.smweb.vo.query.*;

/**
 * @author Albert email:albert(a)buyantech.com
 * @version 1.0
 * @date 2012-05-10
 */


import org.springframework.stereotype.Repository;

@Repository
public class AllianceDao extends BaseHibernateDao<Alliance,java.lang.String>{

	@Override
	public Class getEntityClass() {
		return Alliance.class;
	}
	
	public Page findPage(AllianceQuery query) {
		String sql = "select t from Alliance t where 1=1 "
				+ "/~ and t.id = {id} ~/"
			  	+ "/~ and t.name = {name} ~/"
			  	+ "/~ and t.iocpath = {iocpath} ~/"
			  	+ "/~ and t.url = {url} ~/"
			  	+ "/~ and t.state = {state} ~/"
				+ "/~ order by [sortColumns] ~/";

        //生成sql2的原因是为了不喜欢使用xsqlbuilder的同学，请修改生成器模板，删除本段的生成
		return pageQuery(sql,query);
	}

	public Page searchPage(AllianceQuery query) {
		String sql = "select t from Alliance t where 1=1 "
			  	+ "/~ and t.id like '%[id]%' ~/"
			  	+ "/~ and t.name like '%[name]%' ~/"
			  	+ "/~ and t.clientType like '%[clientType]%' ~/"
			  	+ "/~ and t.iocpath like '%[iocpath]%' ~/"
			  	+ "/~ and t.url like '%[url]%' ~/"
			  	+ "/~ and t.state like '%[state]%' ~/"
				+ "/~ order by [sortColumns] ~/";
		return pageQuery(sql,query);
	}
 
}
